{include file="public/_meta" /}
<title>标签列表</title>
<style>
	input{
		border:none;
	}
	.text-c td:nth-chid
</style>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 系统管理 <span class="c-gray en">&gt;</span> 标签列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<!-- <div class="text-c"> 
		<input type="text" class="input-text" style="width:250px" placeholder="输入用户名称" id="" name="us_name">
		<button type="submit" class="btn btn-success" name=""><i class="Hui-iconfont">&#xe665;</i>搜用户</button>
	</div> -->
	<table class="table table-border table-bordered table-bg">
		
		<thead>
			
			<tr class="text-c">
				<th width="40">名称</th>
				<th width="150">图片</th>
				<th width="150">操作</th>
			</tr>
		</thead>
		<form action="">
		<tbody>
			{volist name='list' id="vo"}
			<tr class="text-c">
				<td><input type="text" name="{$i}[name]" value="{$vo.name}" style="width: 100%;height: 100%; text-align: center;"></td>
				<td>
					<div style="position: relative;width: 50px;height: 50px;    margin: auto;">
					<img src="{$vo.pic|default='/static/admin/img/add0.png'}" style="width:50px;height:50px" class="logo{$i}" alt="">
					<input type="file" name="file" onchange="eee($(this),{$i})" class="input-text" style="position: absolute;left: 0;top: 0;width: 100%;height: 100%;opacity: 0;">
					<input type="text" name="{$i}[pic]" hidden="hidden" value="{$vo.pic}" class="pic{$i}" >
					</div>
				</td>
				<td>
					<a style="text-decoration:none" onclick="del(this)">删除</a>
				</td>
			</tr>
			{/volist}
		</tbody>

		</form>
	</table>
	<div class="row cl">
		<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2" style="    text-align: center;margin-top: 50px;">
			<button onclick="return edit();" class="btn btn-primary radius" type="submit"><i clsass="Hui-iconfont">&#xe632;</i> 保存</button>
		</div>
	</div>
</div>
{include file="public/_footer" /}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="/static/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="/static/admin/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
	$(function(){
		// console.log($("").val(111))
		
	})
	function eee(dada,i) {
        var data = new FormData();
        data.append('file', dada[0].files[0]);
        var index = layer.load(1, { shade: false }); //0代表加载的风格，支持0-2
        $.ajax({
            url: '{:url("store/upload")}',
            type: 'POST',
            data: data,
            cache: false,
            contentType: false,
            processData: false,
            success: function(data) {
                // layer.msg(data.msg);
                layer.close(index);
                if (data.code) {
                    $('.logo'+i).attr('src',data.data);
                    $('.pic'+i).val(data.data);
                }
                layer.close(index);
            },
            error: function() {
                layer.close(index);
                layer.msg('上传出错');
            }
        });
    }
 	function edit(){
 		console.log(123);
    	$.ajax({
    		type:"post",
    		url:"{:url('label')}",
    		data:$('form').serialize(),
    		success:function(data){
    			layer.msg(data.msg);
    		}
    	})
    }
    function del(data){
    	$(data).parent().parent().remove();
    }
</script>
</body>
</html>